#pragma once
#include <boost/serialization/singleton.hpp>
#include <mutex>
#include "IMsgManager.h"
#include "json/value.h"

namespace RobotControl{
namespace Common{

/// \brief 配置管理接口实现
class MsgManager : public boost::serialization::singleton<MsgManager>
{
public:
	/// \brief 配置组建
	bool config(const Json::Value &config);

	/// \brief 启动
	bool start();

	/// \brief 停止
	bool stop();

	/// \brief 获取MsgManager
	IMsgManagerPtr getInstance();

	/// \brief 获取MsgManager
	/// NOTE: 不支持
	IMsgManagerPtr getInstance(const std::string &id);

private:
	IMsgManagerPtr m_default_ptr;
	std::map<std::string, IMsgManagerPtr> m_ptrs;
	std::mutex m_mutex;
};

}
}
